package cn.ceshi.controller;

import cn.ceshi.pojo.User;
import cn.ceshi.service.UserService;
import com.alibaba.fastjson.JSONArray;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/userController")
public class UserController {

    @Resource
    private UserService userService;


    @RequestMapping("/userLogin")
    public String userLogin(User user) {

        System.out.println(user);
        Integer result = userService.userLogin(user);

        return "";
    }

    @RequestMapping("/testAjax")
    @ResponseBody
    public String testAjax(User user) {

        System.out.println(user);
        Map<String, User> map = new HashMap<String, User>();
        map.put("data", user);
        return JSONArray.toJSONString(map);
    }

}

